#include "ArduinoUtils.h"

bool isDigitalSensor(int pinNumber)
{
	return pinNumber >= 0 && pinNumber < 54 ;
}

bool isAnalogSensor(int pinNumber)
{
	return pinNumber >=A0 && pinNumber <= A15;
}

void SetOutput(int pin, int value)
{
	if(isDigitalSensor(pin))
	{
		digitalWrite(pin, value > 0 ? HIGH : LOW);
	}
	else if(isAnalogSensor(pin))
	{
		analogWrite(pin, value);
	}
}

int GetSensorValue(int pin)
{
	if(isDigitalSensor(pin))
	{
		return digitalRead(pin);
	}
	else if(isAnalogSensor(pin))
	{
		return analogRead(pin);
	}
}